<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2011 Mia-Software. All rights reserved. This program and 
	the accompanying materials are made available under the terms of the Eclipse 
	Public License v1.0 which accompanies this distribution, and is available 
	at http://www.eclipse.org/legal/epl-v10.html Contributors: Gregoire DUPE 
	(Mia-Software) - initial contribution -->

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common"
	extension-element-prefixes="exsl" xmlns:m2="http://maven.apache.org/POM/4.0.0">
	<xsl:output indent="yes" />
	<xsl:param name="updatesites" />
	<xsl:param name="testDependencies" />
	<xsl:param name="tychoVersion" />
	<xsl:param name="relengDir" />
	<xsl:param name="antVersionNumber" />
	<xsl:template match="/">
		<project
			xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
			xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
			<xsl:apply-templates select="//m2:project/*" />
			<properties>
				<!-- Tycho settings -->
				<tycho-version>
					<xsl:value-of select="$tychoVersion" />
				</tycho-version>
				<!-- Checkstyle settings -->
				<checkstyle.config.location>../releng/org.eclipse.emf.facet.releng.tycho/checkstyle/EmfFacet.checkstyle
				</checkstyle.config.location>
				<!-- update sites settings -->
				<download.eclipse.org.mirror>download.eclipse.org
				</download.eclipse.org.mirror>
				<!-- Others settings -->
				<maven.compile.deprecation>false</maven.compile.deprecation>
				<maven.test.failure.ignore>true</maven.test.failure.ignore>
				<releng.tycho.skipTests>false</releng.tycho.skipTests>
				<ant.version.number><xsl:value-of select="$antVersionNumber" /></ant.version.number>
			</properties>
			<xsl:copy-of select="document($updatesites)/*" />
		</project>
	</xsl:template>
	<xsl:template match="m2:build">
		<build>
			<sourceDirectory>src</sourceDirectory>
			<plugins>
				<xsl:copy-of select="m2:plugins/*" />
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<version>1.7</version>
					<executions>
						<execution>
							<id>generate-doc</id>
							<phase>generate-resources</phase>
							<goals>
								<goal>run</goal>
							</goals>
							<configuration>
								<target>
									<property name="maven_plugin_classpath" refid="maven.plugin.classpath" />
									<xsl:element name="property">
										<xsl:attribute name="name">workspace</xsl:attribute>
										<xsl:attribute name="value">
												<xsl:value-of select="concat($relengDir, '/..')" />
											</xsl:attribute>
									</xsl:element>
									<xsl:element name="ant">
										<xsl:attribute name="antfile">
											<xsl:value-of select="concat($relengDir, '/ant-scripts.xml')" />
										</xsl:attribute>
										<xsl:attribute name="target">generate-documentation</xsl:attribute>
										<xsl:attribute name="inheritRefs">true</xsl:attribute>
									</xsl:element>
								</target>
							</configuration>
						</execution>
					</executions>
					<dependencies>
						<dependency>
							<groupId>net.sf.saxon</groupId>
							<artifactId>saxon</artifactId>
							<version>8.7</version>
						</dependency>
						<dependency>
							<groupId>ant-contrib</groupId>
							<artifactId>ant-contrib</artifactId>
							<version>1.0b3</version>
							<exclusions>
								<exclusion>
									<groupId>ant</groupId>
									<artifactId>ant</artifactId>
								</exclusion>
								<exclusion>
									<groupId>org.apache.ant</groupId>
									<artifactId>ant</artifactId>
								</exclusion>
							</exclusions>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>tycho-source-plugin</artifactId>
					<version>${tycho-version}</version>
					<executions>
						<execution>
							<id>plugin-source</id>
							<goals>
								<goal>plugin-source</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<version>${tycho-version}</version>
					<artifactId>tycho-packaging-plugin</artifactId>
					<configuration>
						<strictBinIncludes>false</strictBinIncludes>
						<archiveSite>true</archiveSite>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<version>${tycho-version}</version>
					<artifactId>target-platform-configuration</artifactId>
					<configuration>
						<allowConflictingDependencies>true</allowConflictingDependencies>
						<includePackedArtifacts>true</includePackedArtifacts>
					</configuration>
				</plugin>
			</plugins>
		</build>
	</xsl:template>
	<xsl:template match="m2:modules">
		<modules>
			<xsl:copy-of select="*" />
			<module>product</module>
		</modules>
	</xsl:template>
	<xsl:template match="*[name()!='build'][name()!='modules']">
		<xsl:copy-of select="." />
	</xsl:template>
</xsl:stylesheet>
